﻿<UserControl x:Class="WPMind.WP7.Controls.ImagesSwitcher"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">
    <UserControl.Resources>
        <Storyboard x:Name="ImageStoryboard_FadeIn" Completed="ImageStoryboard_Completed">
        	<DoubleAnimation From="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="imageTemp" d:IsOptimized="True"/>
        </Storyboard>
        <Storyboard x:Name="ImageStoryboard_Fly"  Completed="ImageStoryboard_Completed">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.X)" Storyboard.TargetName="imageTemp">
        		<EasingDoubleKeyFrame KeyTime="0" Value="-800"/>
        		<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
        	</DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard x:Name="ImageStoryboard_Scale" Completed="ImageStoryboard_Completed">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(ScaleTransform.ScaleX)" Storyboard.TargetName="imageTemp">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(ScaleTransform.ScaleY)" Storyboard.TargetName="imageTemp">
                <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="imageTemp">
                <EasingPointKeyFrame KeyTime="0" Value="0,0"/>
                <EasingPointKeyFrame KeyTime="0:0:1" Value="0,0"/>
            </PointAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard x:Name="ImageStoryboard_Rotate" Completed="ImageStoryboard_Completed">
            <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="imageTemp">
                <EasingPointKeyFrame KeyTime="0" Value="0,0"/>
                <EasingPointKeyFrame KeyTime="0:0:1" Value="0,0"/>
            </PointAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="imageTemp">
                <EasingDoubleKeyFrame KeyTime="0" Value="90"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}" HorizontalAlignment="Center" VerticalAlignment="Center">
        <Image x:Name="imageMain" Width="{Binding ElementName=LayoutRoot,Path=Width}" Height="{Binding ElementName=LayoutRoot, Path=Height}" HorizontalAlignment="Center" VerticalAlignment="Center" Canvas.ZIndex="0">
            <Image.CacheMode>
                <BitmapCache RenderAtScale="1"></BitmapCache>
            </Image.CacheMode>
        </Image>
    </Grid>
</UserControl>
